package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * 类名：AlipayConfig 功能：基础配置类 详细：设置帐户有关信息及返回路径 修改日期：2017-04-05 说明：
 * 以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 * 该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

	// ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092900623425";

	// 商户私钥，您的PKCS8格式RSA2私钥
	//public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCM6kLnNO3N2mffokSU5e+I1NAojCH5UD5+C8W3VmtixJ4YhIcmCGMys4V4agJK4xjErIBQ0NUu+HNhtDqSioamYCZNbn3r3CQyH48e3RE9ydiBOCeGfl500sdDuHI+cDq7gKOWoA+B9wPiJ1+mLEL4sfego41RWbYPmJ4M6l2cNKQK0/xt7hGZu+JuDMRkBJvBBpn/ne7GPYZLikjEbYLuIeIPcFp7jFZz9UJnDRbbHF7sL72favTIfH8y461wMJiBBkSJIK1ubwO0YmgNzEt0MzloE0speDYUB6wOgCgcVIV/rwAx7uMIDd/j6Aiy4KP2x2K+A3Y+2nnE5PQmC2CnAgMBAAECggEASm6fAjNh/R8FSQoUQbYmzVbj0NccRu2M5NVhDVNXi6chfv/Zx0wc4bYTpSQRq+7CsXgQmx+Dy7iucYhae/cx4oXdFX9sgf4ZHGSxG3NX3RRWCQNZVWBAkmKXoHy306VCULJFNpW7O0H3yihUDJlKksSmcTKSvcquMRTDPz04Tv5w6eAU2upxL95neVt2B0shjxIrzwSH0fNDe2z1NUAeBjVlksg+GDiaOsjOExS1Ro1q5yNQEqXc/aSSnnZjsZtWRd2GU9I9fAON/+CfQs+PtQOs8w5pJfP/DF38xXVruiUQy0E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fF9lONtL9EZYqD4PsRa3YGleRcqRctUoQKBgAdsM64G4g7uIwPJgWubRZ3ZbNDN5zvubEEWcj6iuQGNK6VMwH6oNcWh7ADg9zCuqY0iRdsULDL3JjpF1ho5fHIjbg6rqv5C7HR2ise13q0J4p/Hh+liReE8Nbda5go1JDhwZKCTw2CrEnraj5ICtXlsE3fY9XkCxQf4kf/hMxv1AoGARQXtbSUA/aL9lrBrGgSSAIOaTPjQws1lI2SAXSat2R5klx0OCGQgDFqJA6XbPE4yccjy99I5oU78GLYtjX8FtaOrzqBwVjxEdC7GBRzJWcTYBjpS3s+utPZfiptqBRVpLqL7d4BksctD/ojJzPXHVNrIp4ShMSFeqidJ8dUGBak=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	// public static String alipay_public_key =
	// "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAseSlx1GDy1JH0WV94mfXaEfMDPrLLXWfkeXUFvVuvSBpR4kIegtCgTg5uymgfj8JXmemQi/PxckE96Kq+Mb5e89RUN3bBtVnBBB9SmIeUDVlev/IZXb35VllhV7pJPB4j31dE/6iV0+IfA3PamZcz8g6UBYEWL13oB94f5pyo1zQ+SZchsQh2MJfoNU5FRDe8Tpxm/eFbLKY0IsP4Qr8MZG37Aoj336xPtbHj7S3eXypL6SW5J7gs2CQq95OUFeO3qPMr3ckHCIIMoCqMydFbl17e0wALnVwlrxW9dg/aO1zl9gu3NFBdLsV0dyIpLT9Xv6AEj6RBhkX+Gplu1xFkwIDAQAB";
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZborjPT4ThMEbd7ooXXFdx9huh3r12tC6cMnt59JfPO7ef/DpwTfoMxl4zQbYXIiDC6rk1z08fdwDySIi10byTW8iM2OVqYjkHJO+4PtNRRrQesBcb4UaD+W/2Aqsfk66zrr/LlS2mHa+pNP6TyqNoLz+QR7PmOSgJ/o3KaIg477ePnfJ1cTWT+urU0jMNvbif8/uL53G35cVHIt/LlH9dB08q3pOBGDvUvtOIlYdtxLGGtDxzrgCLN0JmvUFQDLUQg1i9CHUOuKeJ80noVQ4ZAO5QKZ/u1P1nc//NWoXZT3mSFwP0LjMYwtRLlp2SwbN0mpxt25cVolhtKEgh9GQIDAQAB";
	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	// 项目评审的时候这里要改成局域网的地址，不能用localhost
	public static String notify_url = "http://localhost:9090/jja2109_ee/alipaydemo/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问

	public static String return_url = "http://localhost:9090/jja2109_ee/alipaydemo/return_url.jsp";// alipaydemo/return_url.jsp

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";
	// ↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * 
	 * @param sWord 要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}